// 1、导入vue-router  解构出需要的方法，(引入了一个路由模式:hash模式)
import { createRouter, createWebHistory } from 'vue-router'
// 导入组件
import HomeView from '../views/HomeView.vue'
import HomeIndexView from '../views/home/HomeIndexView.vue'

// 教师管理
import TeacherIndexView from "../views/teacher/TeacherIndexView.vue";
import TeachingTimeView from "../views/teacher/TeachingTimeView.vue";
import TeaClassCardView from "../views/teacher/TeaClassCardView.vue";
import TeaClassCheckView from "../views/teacher/TeaClassCheckView.vue";

// 班级管理
import ClassIndexView from "../views/class/ClassIndexView.vue";
import ClassAttendView from "../views/class/ClassAttendView.vue";
import ClassGradesView from "../views/class/ClassGradesView.vue";
import ClassQuestionView from "../views/class/ClassQuestionView.vue";
import ClassStudyView from "../views/class/ClassStudyView.vue";
import ClaStudentsListView from "../views/class/ClaStudentsListView.vue";

// 课程管理
import LessonIndexView from "../views/lesson/LessonIndexView.vue";
import LessonBrushView from "../views/lesson/LessonBrushView.vue";
import LessonSpecialView from "../views/lesson/LessonSpecialView.vue";

// 考试管理
import TestIndexView from "../views/test/TestIndexView.vue";

// 问题库
import QuestionIndexView from "../views/question/QuestionIndexView.vue";

// 配置 路由规则
export const routes = [{
        path: '/',
        name: 'home',
        label: '首页',
        component: HomeView,
        redirect: '/home',
        children: [{
                path: '/home',
                name: 'homeindex',
                label: '首页详情',
                component: HomeIndexView,
            },
            {
                path: 'teacher',
                name: 'teacher',
                label: '教师管理',
                component: TeacherIndexView,
                children: [{
                    path: 'teachingTime',
                    name: 'teachingTime',
                    label: '可授课时间',
                    component: TeachingTimeView,
                }, {
                    path: 'classcard',
                    name: 'classcard',
                    label: '课程表',
                    component: TeaClassCardView,
                }, {
                    path: 'classcheck',
                    name: 'classcheck',
                    label: '课时查询',
                    component: TeaClassCheckView,
                }]
            }, {
                path: 'class',
                name: 'class',
                label: '班级管理',
                component: ClassIndexView,
                children: [{
                        path: 'classattend',
                        name: 'classattend',
                        label: '到课情况',
                        component: ClassAttendView,
                    },
                    {
                        path: 'classgrades',
                        name: 'classgrades',
                        label: '考情分析',
                        component: ClassGradesView,
                    },
                    {
                        path: 'classquestion',
                        name: 'classquestion',
                        label: '题目推送',
                        component: ClassQuestionView,
                    },
                    {
                        path: 'classstudy',
                        name: 'classstudy',
                        label: '学习排行',
                        component: ClassStudyView,
                    },
                    {
                        path: 'studentslist',
                        name: 'studentslist',
                        label: '学生列表',
                        component: ClaStudentsListView,
                    },
                ]
            }, {
                path: 'lesson',
                name: 'lesson',
                label: '课程管理',
                component: LessonIndexView,
                children: [{
                        path: 'lessonbrush',
                        name: 'lessonbrush',
                        label: '刷题训练',
                        component: LessonBrushView,
                    },
                    {
                        path: 'lessonspecial',
                        name: 'lessonspecial',
                        label: '专项训练',
                        component: LessonSpecialView,
                    },
                ]
            }, {
                path: 'test',
                name: 'test',
                label: '考试管理',
                component: TestIndexView,
            },
            {
                path: 'question',
                name: 'question',
                label: '问题库',
                component: QuestionIndexView,
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        label: '登录',
        component: () =>
            import ('../views/LoginView.vue')
    },
    {
        path: "/login1",
        name: "login1",
        // route level code-splitting
        // this generates a separate chunk (About.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ("../views/LoginView psw.vue"),
    },
];

const router = createRouter({
    history: createWebHistory(
        import.meta.env.BASE_URL),
    routes
});

export default router;